# -*- coding: utf-8 -*-
from django.db import models
from DjangoUeditor.models import UEditorField
from apps.map import *
# Create your models here.


class Store(models.Model):
    '''
    店铺
    '''
    title = models.CharField(verbose_name='店铺名',max_length=50,blank=False)
    type = models.CharField(verbose_name='店铺类型',blank=False,choices=STORE_TYPE_CHOICES,max_length=20)
    area = models.CharField(verbose_name='地点',blank=True,null=True,max_length=200)
    contact = models.CharField(verbose_name='联系方式',blank=False,max_length=200)
    is_active = models.CharField(verbose_name='经营状态',choices=STORE_STATE_CHOICES,max_length=2,default='00')
    is_own = models.CharField(verbose_name='店铺自有',choices=STORE_BELONG,max_length=2,default='00')
    info = UEditorField(
        verbose_name=u'备注/补充',
        blank=True,
        null=True,
        width=600, height=300,
        # toolbars="full",
        imagePath="organization/store/",  # 相对路径
        filePath="organization/store/",
        default = ""  # 新增字段时，为避免出错可以设置default=""
        # upload_settings={"imageMaxSize":1204000},
        # settings={},
        # command=None,
        # event_handler=myEventHander(),
        # blank=True
    )
    created = models.DateTimeField(verbose_name='创建时间', auto_now_add=True)
    modified = models.DateTimeField(verbose_name='修改时间', auto_now=True)

    class Meta:
        verbose_name = "店铺"
        verbose_name_plural = verbose_name
        ordering = ["-created"]
        # db_table  # default app_model
        # unique_together = (("field", "field"),)

    def __str__(self):
        # return ' {0} : {1} '.format(self.type,self.title)
        return self.title

